/**
 * @Time    : 2022/03/09 15:19
 * @Author  : WanRongJia
 * @License : Software business license
 * @Site    : www.linshensjl.top
 * @File    : insert.js
 * @Software: Rich Web Platform
 * @Function: 新增菜单
 * @Version : 1.0
 **/
const { matchedData } = require('express-validator')
const { insertMenu } = require('./helpers/insertMenu')
const { buildResponse } = require('../../../utils/buildResponse')
const insert = async function (req, res) {
    try {
        req = matchedData(req)
        let menuInfo = await insertMenu(req)
        res.json(buildResponse(menuInfo, '新增成功', true))
    } catch (e) {
        res.json(e)
    }
}

module.exports = { insert }